VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "TestMethodFixtureMocked"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private mFixture As MethodFixture
Private mObject1 As MockFixture
Private mObject2 As MockFixture
Private mNotify As New MockNotifier

Public Sub testWithTwoObjects()
givenMethodFixture
whenCalled
thenBothCalled
thenElapsedTimeIs2
End Sub
Public Sub testWithTwoObjectsRaisingErrors()
givenMethodFixtureErrors
whenCalled
thenFirstCalled
thenElapsedTimeIs1
End Sub


''
''
Private Sub givenMethodFixture()
Set mFixture = New MethodFixture
mFixture.Add mObject1
mFixture.Add mObject2
End Sub
Private Sub givenMethodFixtureErrors()
givenMethodFixture
mObject1.raises = True
End Sub

Private Sub whenCalled()
mFixture.forward mNotify
End Sub


Private Sub thenBothCalled()
assert.isTrue mObject1.called, "Called 1"
assert.isTrue mObject2.called, "Called 2"
End Sub
Private Sub thenFirstCalled()
assert.isTrue mObject1.called, "Called 1"
assert.isFalse mObject2.called, "Not Called 2"
End Sub

Private Sub thenElapsedTimeIs2()
assert.equals mFixture.elapsedTime, 2, "Time is 2 when both called"
End Sub
Private Sub thenElapsedTimeIs1()
assert.equals mFixture.elapsedTime, 1, "Time is 1 when one called"
End Sub


'OPTIONAL METHODS
Public Sub setup()
Set mObject1 = New MockFixture
Set mObject2 = New MockFixture
End Sub


Public Function NumOfAsserts() As Long
NumOfAsserts = 6
End Function

